export function createElement(tag) {
  return document.createElement(tag)
}

export function createText(text) {
  return document.createTextNode(text)
}

export function setText(el, text) {
  el.textContent = text
}

export function insertElement(container, node, beforeNode) {
  return container.insertBefore(node, beforeNode)
}

export function insertAfterElement(node, target) {
  return target.parentNode.insertBefore(node, target.nextSibling)
}

export function querySelector(sel) {
  return document.querySelector(sel)
}
export function removeElement(node) {
  return node?.parentNode.removeChild(node)
}
export function replaceElement(oldEl, newEl) {
  insertElement(oldEl.parentNode, newEl, oldEl)
  removeElement(oldEl)
}
export function moveAfterElement(node, target) {
  insertElement(target.parentNode, node, target.nextSibling)
}
export function moveBeforeElement(node, target) {
  insertElement(target.parentNode, node, target)
}
// export function pathStyle(node, style = '') {
//   node.style = style
// }
// export function patchClass(node, className = '') {
//   node.className = className
// }

export function setAttribute(container, key, value) {
  container.setAttribute(key, value)
}

export function removeAttribute(container, key) {
  container.removeAttribute(key)
}
